<template>
  <!-- 测量数据取样配置表单弹窗 -->
  <el-dialog
    :close-on-click-modal="false"
    v-model="visibleDialog"
    :title="props.title"
    :width="props.isReadonly ? '1400px' : '1000px'"
    draggable
    @close="closeDialog"
  >
    <el-form
      ref="formRef"
      v-show="!props.isReadonly"
      :model="formData"
      :rules="rules"
      label-width="220"
    >
      <el-row>
        <el-col :span="11">
          <el-form-item label="过程质量监控分类" prop="abilityType">
            <el-select
              v-model="formData.abilityType"
              placeholder="请选择过程质量监控分类"
              clearable
              :disabled="formData.id !== '' || props.abilityType != ''"
              style="width: 100%"
              @change="abilityTypeChange"
            >
              <el-option
                v-for="item in dictionaryStore.filterDictList('AbilityType')"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item label="检具用途">
            <el-select
              style="width: 100%"
              disabled
              v-model="formData.toolUseType"
              placeholder="请选择量检具用途"
              clearable
            >
              <el-option
                v-for="item in useDictionary('samplingStatus')"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="1" />
        <el-col :span="23">
          <el-form-item label="监控描述">
            <el-input
              v-model="formData.memo"
              placeholder="请输入监控描述"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" />

        <el-col :span="23">
          <el-form-item label="备注">
            <el-input v-model="formData.remarks" clearable type="textarea" />
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 阶段显示 -->
      <el-row v-if="formData.abilityType == '6'">
        <el-col :span="11">
          <el-form-item label="计算样本最低数量" prop="ruleLowestNum">
            <el-input
              v-model="formData.ruleLowestNum"
              placeholder="请输入计算样本最低数量"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="趋势图能够开始计算的最小采样数"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>
        <el-col :span="11">
          <el-form-item
            :label="!isNotStage ? '去掉数量' : '样本节拍比对件数'"
            prop="continuousNum"
          >
            <el-input
              v-model="formData.continuousNum"
              :placeholder="`请输入${
                !isNotStage ? '去掉数量' : '样本节拍比对件数'
              }`"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            :content="`${
              !isNotStage
                ? '每次执行完事去掉检测数量'
                : '趋势图每次采样采集数据，之前必须是连续个数'
            }`"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>
        <el-col :span="11">
          <el-form-item label="首次执行时间" prop="firstExecutionTime">
            <el-date-picker
              style="width: 100%"
              v-model="formData.firstExecutionTime"
              :disabled="true"
              type="datetime"
              placeholder="请选择首次执行时间"
              format="YYYY-MM-DD HH"
              value-format="YYYY-MM-DD HH"
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" />
      </el-row>
      <!-- 其他显示 -->
      <el-row
        v-if="
          formData.abilityType == '4' ||
          formData.abilityType == '5' ||
          formData.abilityType == '7'
        "
      >
        <el-col :span="11">
          <el-form-item label="计算样本最低数量" prop="ruleLowestNum">
            <el-input
              v-model="formData.ruleLowestNum"
              placeholder="请输入计算样本最低数量"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="趋势图能够开始计算的最小采样数"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>

        <el-col :span="11" v-if="isNotStage">
          <el-form-item label="计算最低取样时长(天)" prop="ruleLowestDuration">
            <el-input
              v-model="formData.ruleLowestDuration"
              placeholder="请输入计算最低取样时长(天)"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" v-if="isNotStage">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="趋势图能够开始计算的最小采样时间"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>

        <el-col :span="11">
          <el-form-item
            :label="!isNotStage ? '去掉数量' : '样本节拍比对件数'"
            prop="continuousNum"
          >
            <el-input
              v-model="formData.continuousNum"
              :placeholder="`请输入${
                !isNotStage ? '去掉数量' : '样本节拍比对件数'
              }`"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            :content="`${
              !isNotStage
                ? '每次执行完事去掉检测数量'
                : '趋势图每次采样采集数据，之前必须是连续个数'
            }`"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>

        <el-col :span="11" v-if="isNotStage">
          <el-form-item label="节拍比对倍数" prop="intervalSecond">
            <el-input
              v-model="formData.intervalSecond"
              placeholder="请输入节拍比对倍数"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" v-if="isNotStage">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="趋势图采样数量之间时间间隔小于，则合格采样"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>

        <el-col :span="11">
          <el-form-item label="首次执行时间" prop="firstExecutionTime">
            <el-date-picker
              style="width: 100%"
              v-model="formData.firstExecutionTime"
              :disabled="true"
              type="datetime"
              placeholder="请选择首次执行时间"
              format="YYYY-MM-DD HH"
              value-format="YYYY-MM-DD HH"
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" />
        <el-col :span="11" v-if="isNotStage">
          <el-form-item label="取样间隔（小时）" prop="intervalHour">
            <el-input
              v-model="formData.intervalHour"
              placeholder="请输入取样间隔（小时）"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" v-if="isNotStage">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="进行采样的间隔时间"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>

        <el-col :span="11" v-if="isNotStage">
          <el-form-item label="CPK计算周期（小时）" prop="cpkComputeHour">
            <el-input
              v-model="formData.cpkComputeHour"
              placeholder="请输入CPK计算周期（小时）"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" v-if="isNotStage">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="趋势图首次计算后，进行CPK计算的间隔时间"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>

        <el-col :span="11" v-if="isNotStage">
          <el-form-item label="取样最大范围" prop="maxRange">
            <el-input
              v-model="formData.maxRange"
              placeholder="请输入取样最大范围"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" v-if="isNotStage">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="趋势图计算采样数最大范围（按月或按采样数量）"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>

        <el-col :span="11" v-if="isNotStage">
          <el-form-item label="取样范围滚动间隔" prop="rollInterval">
            <el-input
              v-model="formData.rollInterval"
              placeholder="请输入取样范围滚动间隔"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" v-if="isNotStage">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="达到最大范围后，舍弃最早数据"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>

        <el-col :span="11" v-if="isNotStage">
          <el-form-item label="取样最大范围单位" prop="maxUnit">
            <el-select
              v-model="formData.maxUnit"
              placeholder="请选择取样最大范围单位"
              clearable
              style="width: 100%"
            >
              <el-option
                v-for="item in dictionaryStore.filterDictList('MaxUnit')"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="1" v-if="isNotStage">
          <el-popover
            placement="top-end"
            :width="200"
            trigger="hover"
            content="取样最大范围的单位（月/采样个数）"
          >
            <template #reference>
              <span class="yellow-icon">
                <el-icon><QuestionFilled /></el-icon>
              </span>
            </template>
          </el-popover>
        </el-col>
      </el-row>
      <el-divider content-position="left" v-if="formData.abilityType != ''"
        ><div style="font-weight: 700">报警设置</div></el-divider
      >
      <!-- 单值图显示 -->
      <el-row v-if="formData.abilityType == '0' || formData.abilityType == '1'">
        <el-col :span="11">
          <el-form-item label="单值图默认节点展示数量" prop="sampleNum">
            <el-input
              v-model="formData.sampleNum"
              placeholder="请输入单值图默认节点展示数量"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item label="当超过控制限上下限，是否预警">
            <el-switch
              v-model="formData.isWarn"
              inline-prompt
              active-value="1"
              inactive-value="0"
              active-text="是"
              inactive-text="否"
            />
          </el-form-item>
        </el-col>

        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item
            :label-width="'220px'"
            label="控制线上限收严比例"
            prop="upLine"
          >
            <el-input
              v-model="formData.upLine"
              placeholder="控制线上限收严比例"
              clearable
            />
          </el-form-item>
        </el-col>

        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item
            :label-width="'220px'"
            label="控制线下限收严比例"
            prop="downLine"
          >
            <el-input
              v-model="formData.downLine"
              placeholder="控制线下限收严比例"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item
            :label-width="'220px'"
            label="预警触发：连续超过控制限次数"
            prop="controlRate"
          >
            <el-input
              v-model="formData.controlRate"
              placeholder="预警触发：连续超过控制限次数"
              clearable
            />
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 均值图 -->
      <el-row v-if="formData.abilityType == '2' || formData.abilityType == '3'">
        <el-col :span="11">
          <el-form-item label="均值图默认展示个数" prop="sampleNum">
            <el-input
              v-model="formData.sampleNum"
              placeholder="请输入均值图默认展示个数"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item
            label="子组样本数量"
            prop="groupingNum"
            :label-width="'220px'"
          >
            <el-input
              v-model="formData.groupingNum"
              placeholder="请输入子组样本数量"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item label="生成预警">
            <el-switch
              v-model="formData.isWarn"
              inline-prompt
              active-value="1"
              inactive-value="0"
              active-text="是"
              inactive-text="否"
            />
          </el-form-item>
        </el-col>
        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item
            :label-width="'220px'"
            label="预警触发条件：偏移量"
            prop="controlRate"
          >
            <el-input
              v-model="formData.controlRate"
              placeholder="请输入预警触发条件：偏移量"
              clearable
            />
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 长期 -->
      <el-row
        v-if="formData.abilityType == '4' || formData.abilityType == '5'"
        style="width: 100%"
      >
        <el-col :span="11">
          <el-form-item label="趋势图中的点低于" prop="controlRate">
            <el-input
              v-model="formData.controlRate"
              placeholder="请输入预警触发: 趋势图中的点低于"
              clearable
            />
          </el-form-item>
        </el-col>

        <el-col :span="1" />
        <el-col :span="11">
          <el-form-item label="当超过控制限上下限，是否预警">
            <el-switch
              v-model="formData.isWarn"
              inline-prompt
              active-value="1"
              inactive-value="0"
              active-text="是"
              inactive-text="否"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 过程 -->
      <el-row
        v-if="
          formData.abilityType == '7' ||
          formData.abilityType == '6' ||
          formData.abilityType == '5' ||
          formData.abilityType == '4'
        "
        style="display: flex; justify-content: center"
      >
        <p style="width: 80%">
          在第一次产生报警、预警后，相关MFE责任人在
          <el-form-item
            prop="checkHour"
            :show-message="false"
            label-width="10"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.checkHour" style="width: 45px" />
          </el-form-item>
          小时内需完成系统登录， 说明调查结果，之后需要每
          <el-form-item
            prop="updateHour"
            :show-message="false"
            label-width="10"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.updateHour" style="width: 45px" />
          </el-form-item>
          小时内对工单进行更新，
          否则系统会再次给相关工序责任人进行邮件提醒，超过
          <el-form-item
            prop="escalateStopover"
            :show-message="false"
            label-width="10"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.escalateStopover" style="width: 45px" />
          </el-form-item>
          次邮件提醒， 系统自动发送邮件升级到上一级领导，直至工单关闭。
        </p>
      </el-row>

      <!-- 阶段 -->
      <el-row
        v-if="formData.abilityType == '6'"
        style="display: flex; justify-content: center"
      >
        <p style="width: 80%">
          过程能力趋势图cpk均高于
          <el-form-item
            prop="defaultTall"
            label-width="0"
            :show-message="false"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.defaultTall" style="width: 45px" />
          </el-form-item>
          并且cpk连续
          <el-form-item
            prop="tallStopover"
            label-width="0"
            :show-message="false"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.tallStopover" style="width: 45px" />
          </el-form-item>
          次高于
          <el-form-item
            prop="successiveTall"
            label-width="0"
            :show-message="false"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.successiveTall" style="width: 45px" />
          </el-form-item>
          以上
        </p>
        <p style="width: 80%">
          <!-- 第二段文字 -->

          过程能力趋势图中的点均低于
          <el-form-item
            prop="defaultLow"
            label-width="0"
            :show-message="false"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.defaultLow" style="width: 45px" />
          </el-form-item>
          并且cpk连续
          <el-form-item
            prop="lowStopover"
            label-width="0"
            :show-message="false"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.lowStopover" style="width: 45px" />
          </el-form-item>
          次呈持续下降趋势
        </p>
        <el-col :span="18">
          <el-form-item label="当超过控制限上下限，是否预警">
            <el-switch
              v-model="formData.isWarn"
              inline-prompt
              active-value="1"
              inactive-value="0"
              active-text="是"
              inactive-text="否"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <!-- <el-row v-if="formData.abilityType == '3'" style="margin-left: 50px">
          <el-col :span="12">
            <el-form-item label="当超过控制限上下限，是否预警">
              <el-switch
                v-model="formData.isWarn"
                inline-prompt
                active-value="1"
                inactive-value="0"
                active-text="是"
                inactive-text="否"
              />
            </el-form-item>
          </el-col>
          
        </el-row> -->
      <!-- 特殊 -->
      <el-row
        v-if="formData.abilityType == '7'"
        style="display: flex; justify-content: center"
      >
        <p style="width: 80%">
          过程能力趋势图cpk均高于
          <el-form-item
            prop="defaultTall"
            label-width="0"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.defaultTall" style="width: 45px" />
          </el-form-item>
          并且cpk连续
          <el-form-item
            prop="tallStopover"
            label-width="0"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.tallStopover" style="width: 45px" />
          </el-form-item>
          次高于
          <el-form-item
            prop="successiveTall"
            label-width="0"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.successiveTall" style="width: 45px" />
          </el-form-item>
          以上

          <!-- 第二段文字 -->
        </p>
        <p style="width: 80%">
          过程能力趋势图中的点均低于
          <el-form-item
            prop="defaultLow"
            label-width="0"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.defaultLow" style="width: 45px" />
          </el-form-item>
          并且cpk连续
          <el-form-item
            prop="lowStopover"
            label-width="0"
            style="display: inline-block; margin: 0"
          >
            <el-input v-model="formData.lowStopover" style="width: 45px" />
          </el-form-item>
          次呈持续下降趋势
        </p>
        <el-col :span="18">
          <el-form-item label="当超过控制限上下限，是否预警">
            <el-switch
              v-model="formData.isWarn"
              inline-prompt
              active-value="1"
              inactive-value="0"
              active-text="是"
              inactive-text="否"
            />
          </el-form-item>
        </el-col>
      </el-row>

      <!-- <el-row v-if="formData.abilityType == '4'" style="margin-left: 50px">
          <el-col :span="12">
            <el-form-item label="当超过控制限上下限，是否预警">
              <el-switch
                v-model="formData.isWarn"
                inline-prompt
                active-value="1"
                inactive-value="0"
                active-text="是"
                inactive-text="否"
              />
            </el-form-item>
          </el-col>
         
        </el-row> -->
    </el-form>

    <div
      style="
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
      "
      v-if="props.isReadonly"
    >
      <div>
        <h4>当前详情</h4>
        <el-descriptions v-show="props.isReadonly" title="" :column="3" border>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">过程质量监控分类</div>
            </template>
            <div style="width: 100%; word-break: break-all">
              {{ useDictionary("AbilityType", formData.abilityType) || "" }}
            </div>
          </el-descriptions-item>
          <el-descriptions-item :span="2">
            <template #label>
              <div class="cell-item">检具用途</div>
            </template>
            <div style="width: 100%; word-break: break-all">
              {{
                useDictionary("toolUseType", Number(formData.toolUseType)) || ""
              }}
            </div>
          </el-descriptions-item>
          <el-descriptions-item :span="3">
            <template #label>
              <div class="cell-item">监控描述</div>
            </template>
            <div
              style="width: 100%; word-break: break-all"
              :style="{
                color: oldList[0]?.memo == formData.memo ? '' : 'red',
              }"
            >
              {{ formData.memo }}
            </div>
          </el-descriptions-item>
          <el-descriptions-item :span="3">
            <template #label>
              <div class="cell-item">备注</div>
            </template>
            <div
              style="width: 100%; word-break: break-all"
              :style="{
                color: oldList[0]?.remarks == formData.remarks ? '' : 'red',
              }"
            >
              {{ formData.remarks }}
            </div>
          </el-descriptions-item>
          <!-- 其他显示 -->
          <div
            v-if="
              formData.abilityType == '4' ||
              formData.abilityType == '5' ||
              formData.abilityType == '7'
            "
          >
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">计算样本最低数量</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.ruleLowestNum || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">计算最低取样时长(天)</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.ruleLowestDuration || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">样本节拍比对件数</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.continuousNum || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">节拍比对倍数</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.intervalSecond || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">首次执行时间</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.firstExecutionTime || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">取样间隔（小时）</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.intervalHour || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">CPK计算周期（小时）</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.cpkComputeHour || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">取样最大范围</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.maxRange || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">取样范围滚动间隔</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ formData.rollInterval || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage" :span="2">
              <template #label>
                <div class="cell-item">取样最大范围单位</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ useDictionary("MaxUnit", formData.maxUnit) || "" }}
              </div>
            </el-descriptions-item>
          </div>

          <!-- 单值图 -->
          <div
            v-if="formData.abilityType == '0' || formData.abilityType == '1'"
          >
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">单值图默认节点展示数量</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color:
                    oldList[0]?.sampleNum == formData.sampleNum ? '' : 'red',
                }"
              >
                {{ formData.sampleNum || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">当超过控制限上下限，是否预警</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color: oldList[0]?.isWarn == formData.isWarn ? '' : 'red',
                }"
              >
                {{ formData.isWarn == "1" ? "是" : "否" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">控制线上限收严比例</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color: oldList[0]?.upLine == formData.upLine ? '' : 'red',
                }"
              >
                {{ formData.upLine || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">控制线下限收严比例</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color: oldList[0]?.downLine == formData.downLine ? '' : 'red',
                }"
              >
                {{ formData.downLine || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">预警触发：连续超过控制限次数</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color:
                    oldList[0]?.controlRate == formData.controlRate
                      ? ''
                      : 'red',
                }"
              >
                {{ formData.controlRate || "" }}
              </div>
            </el-descriptions-item>
          </div>
          <!-- 均值图 -->
          <div
            v-if="formData.abilityType == '2' || formData.abilityType == '3'"
          >
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">均值图默认展示个数</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color:
                    oldList[0]?.sampleNum == formData.sampleNum ? '' : 'red',
                }"
              >
                {{ formData.sampleNum || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">子组样本数量</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color:
                    oldList[0]?.groupingNum == formData.groupingNum
                      ? ''
                      : 'red',
                }"
              >
                {{ formData.groupingNum || "" }}
              </div>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">生成预警</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color: oldList[0]?.isWarn == formData.isWarn ? '' : 'red',
                }"
              >
                {{ formData.isWarn == "1" ? "是" : "否" }}
              </div>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">预警触发条件：偏移量</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color:
                    oldList[0]?.controlRate == formData.controlRate
                      ? ''
                      : 'red',
                }"
              >
                {{ formData.controlRate || "" }}
              </div>
            </el-descriptions-item>
          </div>

          <!-- 长期 -->
          <div
            v-if="formData.abilityType == '4' || formData.abilityType == '5'"
          >
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">趋势图中的点低于</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color:
                    oldList[0]?.controlRate == formData.controlRate
                      ? ''
                      : 'red',
                }"
              >
                {{ useDictionary("MaxUnit", formData.controlRate) || "" }}
              </div>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">当超过控制限上下限，是否预警</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color: oldList[0]?.isWarn == formData.isWarn ? '' : 'red',
                }"
              >
                {{ formData.isWarn == "1" ? "是" : "否" }}
              </div>
            </el-descriptions-item>
          </div>

          <!-- 阶段 -->
          <el-row v-if="formData.abilityType == '6'">
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">计算样本最低数量</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color:
                    oldList[0]?.ruleLowestNum == formData.ruleLowestNum
                      ? ''
                      : 'red',
                }"
              >
                {{ formData.ruleLowestNum || "" }}
              </div>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  {{ !isNotStage ? "去掉数量" : "样本节拍比对件数" }}
                </div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color:
                    oldList[0]?.continuousNum == formData.continuousNum
                      ? ''
                      : 'red',
                }"
              >
                {{ formData.continuousNum || "" }}
              </div>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">首次执行时间</div>
                </template>
                <div
                  style="width: 100%; word-break: break-all"
                  :style="{
                    color:
                      oldList[0]?.firstExecutionTime ==
                      formData.firstExecutionTime
                        ? ''
                        : 'red',
                  }"
                >
                  {{ formData.firstExecutionTime || "" }}
                </div>
              </el-descriptions-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">当超过控制限上下限，是否预警</div>
              </template>
              <div
                style="width: 100%; word-break: break-all"
                :style="{
                  color: oldList[0]?.isWarn == formData.isWarn ? '' : 'red',
                }"
              >
                {{ formData.isWarn == "1" ? "是" : "否" }}
              </div>
            </el-descriptions-item>
            <!-- <el-col :span="18">
            <el-form-item label="当超过控制限上下限，是否预警">
              <el-switch
                disabled
                v-model="formData.isWarn"
                inline-prompt
                active-value="1"
                inactive-value="0"
                active-text="是"
                inactive-text="否"
              />
            </el-form-item>
          </el-col> -->
          </el-row>
        </el-descriptions>
        <!-- 过程 -->
        <div
          v-if="
            formData.abilityType == '7' ||
            formData.abilityType == '6' ||
            formData.abilityType == '5' ||
            formData.abilityType == '4'
          "
          style="display: flex; justify-content: center"
        >
          <el-row v-if="props.isReadonly">
            <p style="width: 80%">
              在第一次产生报警、预警后，相关MFE责任人在
              <el-form-item
                prop="checkHour"
                :show-message="false"
                label-width="10"
                style="display: inline-block; margin: 0"
              >
                <el-input
                  disabled
                  v-model="formData.checkHour"
                  style="width: 45px"
                  :style="{
                    color:
                      oldList[0]?.checkHour == formData.checkHour ? '' : 'red',
                  }"
                />
              </el-form-item>
              小时内需完成系统登录， 说明调查结果，之后需要每
              <el-form-item
                prop="updateHour"
                :show-message="false"
                label-width="10"
                style="display: inline-block; margin: 0"
              >
                <el-input
                  disabled
                  v-model="formData.updateHour"
                  style="width: 45px"
                  :style="{
                    color:
                      oldList[0]?.updateHour == formData.updateHour
                        ? ''
                        : 'red',
                  }"
                />
              </el-form-item>
              小时内对工单进行更新，
              否则系统会再次给相关工序责任人进行邮件提醒，超过
              <el-form-item
                prop="escalateStopover"
                :show-message="false"
                label-width="10"
                style="display: inline-block; margin: 0"
              >
                <el-input
                  disabled
                  v-model="formData.escalateStopover"
                  style="width: 45px"
                  :style="{
                    color:
                      oldList[0]?.escalateStopover == formData.escalateStopover
                        ? ''
                        : 'red',
                  }"
                />
              </el-form-item>
              次邮件提醒， 系统自动发送邮件升级到上一级领导，直至工单关闭。
            </p>
          </el-row>
        </div>

        <!-- 阶段 -->
        <div
          v-if="formData.abilityType == '6' && props.isReadonly"
          style="display: flex; justify-content: center"
        >
          <p>
            过程能力趋势图cpk均高于
            <el-form-item
              prop="defaultTall"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.defaultTall"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.defaultTall == formData.defaultTall
                      ? ''
                      : 'red',
                }"
              />
            </el-form-item>
            并且cpk连续
            <el-form-item
              prop="tallStopover"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.tallStopover"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.tallStopover == formData.tallStopover
                      ? ''
                      : 'red',
                }"
              />
            </el-form-item>
            次高于
            <el-form-item
              prop="successiveTall"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.successiveTall"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.successiveTall == formData.successiveTall
                      ? ''
                      : 'red',
                }"
              />
            </el-form-item>
            以上

            <!-- 第二段文字 -->

            过程能力趋势图中的点均低于
            <el-form-item
              prop="defaultLow"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.defaultLow"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.defaultLow == formData.defaultLow ? '' : 'red',
                }"
              />
            </el-form-item>
            并且cpk连续
            <el-form-item
              prop="lowStopover"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.lowStopover"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.lowStopover == formData.lowStopover
                      ? ''
                      : 'red',
                }"
              />
            </el-form-item>
            次呈持续下降趋势
          </p>
        </div>
        <!-- 特殊 -->
        <el-row
          v-if="formData.abilityType == '7' && props.isReadonly"
          style="display: flex; justify-content: center"
        >
          <p>
            过程能力趋势图cpk均高于
            <el-form-item
              prop="defaultTall"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.defaultTall"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.defaultTall == formData.defaultTall
                      ? ''
                      : 'red',
                }"
              />
            </el-form-item>
            并且cpk连续
            <el-form-item
              prop="tallStopover"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.tallStopover"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.tallStopover == formData.tallStopover
                      ? ''
                      : 'red',
                }"
              />
            </el-form-item>
            次高于
            <el-form-item
              prop="successiveTall"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.successiveTall"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.successiveTall == formData.successiveTall
                      ? ''
                      : 'red',
                }"
              />
            </el-form-item>
            以上

            <!-- 第二段文字 -->

            过程能力趋势图中的点均低于
            <el-form-item
              prop="defaultLow"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.defaultLow"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.defaultLow == formData.defaultLow ? '' : 'red',
                }"
              />
            </el-form-item>
            并且cpk连续
            <el-form-item
              prop="lowStopover"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="formData.lowStopover"
                style="width: 45px"
                :style="{
                  color:
                    oldList[0]?.lowStopover == formData.lowStopover
                      ? ''
                      : 'red',
                }"
              />
            </el-form-item>
            次呈持续下降趋势
          </p>
          <el-col :span="18">
            <el-form-item label="当超过控制限上下限，是否预警">
              <el-switch
                disabled
                v-model="formData.isWarn"
                inline-prompt
                active-value="1"
                inactive-value="0"
                active-text="是"
                inactive-text="否"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div style="margin-left: 20px" v-if="hh">
        <h4>上次详情</h4>
        <el-descriptions v-show="props.isReadonly" title="" :column="3" border>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">过程质量监控分类</div>
            </template>
            <div style="width: 100%; word-break: break-all">
              {{ useDictionary("AbilityType", oldList[0].abilityType) || "" }}
            </div>
          </el-descriptions-item>
          <el-descriptions-item :span="2">
            <template #label>
              <div class="cell-item">检具用途</div>
            </template>
            <div style="width: 100%; word-break: break-all">
              {{
                useDictionary("toolUseType", Number(oldList[0].toolUseType)) ||
                ""
              }}
            </div>
          </el-descriptions-item>
          <el-descriptions-item :span="3">
            <template #label>
              <div class="cell-item">监控描述</div>
            </template>
            <div style="width: 100%; word-break: break-all">
              {{ oldList[0].memo }}
            </div>
          </el-descriptions-item>
          <el-descriptions-item :span="3">
            <template #label>
              <div class="cell-item">备注</div>
            </template>
            <div style="width: 100%; word-break: break-all">
              {{ oldList[0].remarks }}
            </div>
          </el-descriptions-item>
          <!-- 其他显示 -->
          <div
            v-if="
              oldList[0].abilityType == '4' ||
              oldList[0].abilityType == '5' ||
              oldList[0].abilityType == '7'
            "
          >
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">计算样本最低数量</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].ruleLowestNum || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">计算最低取样时长(天)</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].ruleLowestDuration || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">样本节拍比对件数</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].continuousNum || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">节拍比对倍数</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].intervalSecond || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">首次执行时间</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].firstExecutionTime || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">取样间隔（小时）</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].intervalHour || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">CPK计算周期（小时）</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].cpkComputeHour || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">取样最大范围</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].maxRange || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage">
              <template #label>
                <div class="cell-item">取样范围滚动间隔</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].rollInterval || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item v-if="isNotStage" :span="2">
              <template #label>
                <div class="cell-item">取样最大范围单位</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ useDictionary("MaxUnit", oldList[0].maxUnit) || "" }}
              </div>
            </el-descriptions-item>
          </div>

          <!-- 单值图 -->
          <div
            v-if="
              oldList[0].abilityType == '0' || oldList[0].abilityType == '1'
            "
          >
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">单值图默认节点展示数量</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].sampleNum || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">当超过控制限上下限，是否预警</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].isWarn == "1" ? "是" : "否" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">控制线上限收严比例</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].upLine || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">控制线下限收严比例</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].downLine || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">预警触发：连续超过控制限次数</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].controlRate || "" }}
              </div>
            </el-descriptions-item>
          </div>
          <!-- 均值图 -->
          <div
            v-if="
              oldList[0].abilityType == '2' || oldList[0].abilityType == '3'
            "
          >
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">均值图默认展示个数</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].sampleNum || "" }}
              </div>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">子组样本数量</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].groupingNum || "" }}
              </div>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">生成预警</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].isWarn == "1" ? "是" : "否" }}
              </div>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">预警触发条件：偏移量</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].controlRate || "" }}
              </div>
            </el-descriptions-item>
          </div>

          <!-- 长期 -->
          <div
            v-if="
              oldList[0].abilityType == '4' || oldList[0].abilityType == '5'
            "
          >
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">趋势图中的点低于</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ useDictionary("MaxUnit", oldList[0].controlRate) || "" }}
              </div>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">当超过控制限上下限，是否预警</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].isWarn == "1" ? "是" : "否" }}
              </div>
            </el-descriptions-item>
          </div>

          <!-- 阶段 -->
          <el-row v-if="oldList[0].abilityType == '6'">
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">计算样本最低数量</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].ruleLowestNum || "" }}
              </div>
            </el-descriptions-item>

            <el-descriptions-item>
              <template #label>
                <div class="cell-item">
                  {{ !isNotStage ? "去掉数量" : "样本节拍比对件数" }}
                </div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].continuousNum || "" }}
              </div>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">首次执行时间</div>
                </template>
                <div style="width: 100%; word-break: break-all">
                  {{ oldList[0].firstExecutionTime || "" }}
                </div>
              </el-descriptions-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">当超过控制限上下限，是否预警</div>
              </template>
              <div style="width: 100%; word-break: break-all">
                {{ oldList[0].isWarn == "1" ? "是" : "否" }}
              </div>
            </el-descriptions-item>
            <!-- <el-col :span="18">
            <el-form-item label="当超过控制限上下限，是否预警">
              <el-switch
                disabled
                v-model="oldList[0].isWarn"
                inline-prompt
                active-value="1"
                inactive-value="0"
                active-text="是"
                inactive-text="否"
              />
            </el-form-item>
          </el-col> -->
          </el-row>
        </el-descriptions>
        <!-- 过程 -->
        <div
          v-if="
            oldList[0].abilityType == '7' ||
            oldList[0].abilityType == '6' ||
            oldList[0].abilityType == '5' ||
            oldList[0].abilityType == '4'
          "
          style="display: flex; justify-content: center"
        >
          <el-row v-if="props.isReadonly">
            <p style="width: 80%">
              在第一次产生报警、预警后，相关MFE责任人在
              <el-form-item
                prop="checkHour"
                :show-message="false"
                label-width="10"
                style="display: inline-block; margin: 0"
              >
                <el-input
                  disabled
                  v-model="oldList[0].checkHour"
                  style="width: 45px"
                />
              </el-form-item>
              小时内需完成系统登录， 说明调查结果，之后需要每
              <el-form-item
                prop="updateHour"
                :show-message="false"
                label-width="10"
                style="display: inline-block; margin: 0"
              >
                <el-input
                  disabled
                  v-model="oldList[0].updateHour"
                  style="width: 45px"
                />
              </el-form-item>
              小时内对工单进行更新，
              否则系统会再次给相关工序责任人进行邮件提醒，超过
              <el-form-item
                prop="escalateStopover"
                :show-message="false"
                label-width="10"
                style="display: inline-block; margin: 0"
              >
                <el-input
                  disabled
                  v-model="oldList[0].escalateStopover"
                  style="width: 45px"
                />
              </el-form-item>
              次邮件提醒， 系统自动发送邮件升级到上一级领导，直至工单关闭。
            </p>
          </el-row>
        </div>

        <!-- 阶段 -->
        <div
          v-if="oldList[0].abilityType == '6' && props.isReadonly"
          style="display: flex; justify-content: center"
        >
          <p>
            过程能力趋势图cpk均高于
            <el-form-item
              prop="defaultTall"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].defaultTall"
                style="width: 45px"
              />
            </el-form-item>
            并且cpk连续
            <el-form-item
              prop="tallStopover"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].tallStopover"
                style="width: 45px"
              />
            </el-form-item>
            次高于
            <el-form-item
              prop="successiveTall"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].successiveTall"
                style="width: 45px"
              />
            </el-form-item>
            以上

            <!-- 第二段文字 -->

            过程能力趋势图中的点均低于
            <el-form-item
              prop="defaultLow"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].defaultLow"
                style="width: 45px"
              />
            </el-form-item>
            并且cpk连续
            <el-form-item
              prop="lowStopover"
              label-width="0"
              :show-message="false"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].lowStopover"
                style="width: 45px"
              />
            </el-form-item>
            次呈持续下降趋势
          </p>
        </div>
        <!-- 特殊 -->
        <el-row
          v-if="oldList[0].abilityType == '7' && props.isReadonly"
          style="display: flex; justify-content: center"
        >
          <p>
            过程能力趋势图cpk均高于
            <el-form-item
              prop="defaultTall"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].defaultTall"
                style="width: 45px"
              />
            </el-form-item>
            并且cpk连续
            <el-form-item
              prop="tallStopover"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].tallStopover"
                style="width: 45px"
              />
            </el-form-item>
            次高于
            <el-form-item
              prop="successiveTall"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].successiveTall"
                style="width: 45px"
              />
            </el-form-item>
            以上

            <!-- 第二段文字 -->

            过程能力趋势图中的点均低于
            <el-form-item
              prop="defaultLow"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].defaultLow"
                style="width: 45px"
              />
            </el-form-item>
            并且cpk连续
            <el-form-item
              prop="lowStopover"
              label-width="0"
              style="display: inline-block; margin: 0"
            >
              <el-input
                disabled
                v-model="oldList[0].lowStopover"
                style="width: 45px"
              />
            </el-form-item>
            次呈持续下降趋势
          </p>
          <el-col :span="18">
            <el-form-item label="当超过控制限上下限，是否预警">
              <el-switch
                disabled
                v-model="oldList[0].isWarn"
                inline-prompt
                active-value="1"
                inactive-value="0"
                active-text="是"
                inactive-text="否"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
    </div>

    <template #footer>
      <div class="dialog-footer">
        <el-button
          v-if="!props.isReadonly && formData.programId && formData.id"
          type="danger"
          :loading="loading"
          @click="deleteItem(formData.id)"
          >删 除
        </el-button>
        <el-button
          v-if="!props.isReadonly"
          type="primary"
          :loading="loading"
          @click="handleSubmit"
          >确 定
        </el-button>
        <el-button @click="closeDialog">取 消</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import request from "@/utils/request";
import { useDictStoreHook } from "@/store/modules/dictionary"; // 引入
import { QuestionFilled } from "@element-plus/icons-vue";
import { useDictionary } from "../../../../utils/useTable";
import dayjs from "dayjs";

const dictionaryStore = useDictStoreHook();

defineOptions({
  name: "PCMCONFIGMEASUREMENTSEDIT",
  inheritAttrs: false,
});

const emit = defineEmits(["reset-table", "change-visible"]);

const props = defineProps({
  visible: {
    type: Boolean,
    default: () => {
      return false;
    },
  },
  title: {
    type: String,
    default: () => {
      return "";
    },
  },
  data: {
    type: Object,
    default: () => {
      return {};
    },
  },
  isReadonly: {
    type: Boolean,
    default: () => {
      return false;
    },
  },
  abilityType: {
    type: String,
    default: () => {
      return "";
    },
  },
});

const isNotStage = ref(true);

const visibleDialog = ref(false);
watch(
  () => props.visible,
  (newVal: boolean) => {
    visibleDialog.value = newVal;

    if (formData.id == "" || formData.id == undefined) {
      formData.firstExecutionTime = dayjs(new Date()).format("YYYY-MM-DD HH");
      formData.abilityType = props.abilityType;
      if (
        formData.abilityType == "0" ||
        formData.abilityType == "2" ||
        formData.abilityType == "4"
      ) {
        formData.toolUseType = "2";
      } else {
        formData.toolUseType = "1";
      }
      if (formData.abilityType == "" || formData.abilityType == null) {
        formData.toolUseType = "";
        formData.memo = "";
      } else {
        monitoringDescription.forEach((item) => {
          if (formData.abilityType == item.value) {
            formData.memo = item.label;
          }
        });
      }
    }

    setTimeout(() => {
      formRef.value.clearValidate();
    }, 50);
  }
);

let monitoringDescription = [
  {
    label:
      "从质量数据库中提取100%测量特性的测量数据，按照展示数量形成单值图进行过程分析，并进行预警报警",
    value: "0",
  },
  {
    label:
      "从质量数据库中提取抽检测量特性的测量数据，按照展示数量形成单值图进行过程分析，并进行预警报警",
    value: "1",
  },
  {
    label:
      "从质量数据库中提取100%测量特性的测量数据，根据子组样本数量，按照展示数量形成均值图进行过程分析，并进行预警报警",
    value: "2",
  },
  {
    label:
      "从质量数据库中提取抽检测量特性的测量数据，根据子组样本数量，按照展示数量形成均值图进行过程分析，并进行预警报警",
    value: "3",
  },
  {
    label:
      "从质量数据库中提取100%测量特性的测量数据，根据制定的取样规格及频度，按照固定时间计算并展示过程能力进行分析，并进行预警报警",
    value: "4",
  },
  {
    label:
      "从质量数据库中提取抽检测量特性的测量数据，根据制定的取样规格及频度，按照固定时间计算并展示过程能力进行分析，并进行预警报警",
    value: "5",
  },
  {
    label:
      "从质量数据库中提取抽检测量特性的测量数据，根据制定的取样规格及频度，按照固定的样本量生成数计算并展示过程能力进行分析，并进行预警报警",
    value: "6",
  },
  {
    label:
      "从质量数据库中提取抽检测量特性的测量数据，根据控制计划要求的送检分类，按照不同送检代码后缀样本量生成数计算并展示过程能力进行分析，并进行预警报警",
    value: "7",
  },
];

const rules = reactive({
  countRuleCode: [
    { required: true, message: "请输入取样规则编码", trigger: "change" },
    { max: 20, message: "规则编码不能超过20个字符", trigger: "blur" },
  ],
  abilityType: [
    { required: true, message: "请选择过程质量监控分类", trigger: "change" },
  ],
  ruleLowestNum: [
    { required: true, message: "请输入计算样本最低数量", trigger: "change" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  ruleLowestDuration: [
    {
      required: true,
      message: "请输入计算最低取样时长(天)",
      trigger: "change",
    },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  continuousNum: [
    { required: true, message: "请输入数量", trigger: "change" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  intervalSecond: [
    { required: true, message: "请输入节拍比对倍数", trigger: "change" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  firstExecutionTime: [
    { required: true, message: "请选择首次执行时间", trigger: "change" },
  ],
  intervalHour: [
    { required: true, message: "请输入取样间隔（小时）", trigger: "change" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  cpkComputeHour: [
    { required: true, message: "请输入CPK计算周期（小时）", trigger: "change" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  maxRange: [
    { required: true, message: "请输入取样最大范围", trigger: "change" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  minRange: [
    { required: true, message: "请输入取样最大范围", trigger: "change" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  rollInterval: [
    { required: true, message: "请输入取样范围滚动间隔", trigger: "change" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  maxUnit: [
    { required: true, message: "请选择取样最大范围单位", trigger: "change" },
  ],

  sampleNum: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 是否预警(单值,均值,长期,阶段, 特殊)
   */
  isWarn: [{ required: true, message: "请选择", trigger: "change" }],
  /**
   * 连续超过控制限次数(单值,均值,长期)
   */
  controlRate: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 上限比例(单值)
   */
  upLine: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 下限比例(单值)
   */
  downLine: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 分组测量值个数(均值)
   */
  groupingNum: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 默认高于值(阶段, 特殊)
   */
  defaultTall: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 连续高于次数(阶段, 特殊)
   */
  tallStopover: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 连续高于值(阶段, 特殊)
   */
  successiveTall: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 连续低于次数(阶段, 特殊)
   */
  lowStopover: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 默认低于值(阶段, 特殊)
   */
  defaultLow: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 首次调查时间(长期, 阶段, 特殊)
   */
  checkHour: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 更新时间(长期, 阶段, 特殊)
   */
  updateHour: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
  /**
   * 升级次数(长期, 阶段, 特殊)
   */
  escalateStopover: [
    { required: true, message: "请输入", trigger: "blur" },
    {
      pattern: /^(0|[1-9][0-9]*)$/,
      message: "只能请输入正整数",
      trigger: "blur",
    },
  ],
});

const formRef = ref(ElForm);

let formData = reactive({
  id: "",
  countRuleCode: "",
  programId: "",
  abilityType: "",
  ruleLowestNum: "",
  ruleLowestDuration: "",
  continuousNum: "",
  intervalSecond: "",
  firstExecutionTime: "",
  intervalHour: "",
  cpkComputeHour: "",
  maxRange: "",
  rollInterval: "",
  maxUnit: "",
  version: "",
  enabled: "",
  deleted: "",
  createTime: "",
  createdUserId: "",
  createdUserName: "",
  lastUpdatedUserId: "",
  lastUpdatedUserName: "",
  lastUpdateTime: "",
  gageEquipToolKind: "",
  toolUseType: "",
  //后加
  /**
   * 默认样本个数(单值,均值)
   */
  sampleNum: "",
  /**
   * 是否预警(单值,均值,长期,阶段, 特殊)
   */
  isWarn: "",
  /**
   * 连续超过控制限次数(单值,均值,长期)
   */
  controlRate: "",
  /**
   * 上限比例(单值)
   */
  upLine: "",
  /**
   * 下限比例(单值)
   */
  downLine: "",
  /**
   * 分组测量值个数(均值)
   */
  groupingNum: "",
  /**
   * 默认高于值(阶段, 特殊)
   */
  defaultTall: "",
  /**
   * 连续高于次数(阶段, 特殊)
   */
  tallStopover: "",
  /**
   * 连续高于值(阶段, 特殊)
   */
  successiveTall: "",
  /**
   * 连续低于次数(阶段, 特殊)
   */
  lowStopover: "",
  /**
   * 默认低于值(阶段, 特殊)
   */
  defaultLow: "",
  /**
   * 首次调查时间(长期, 阶段, 特殊)
   */
  checkHour: "",
  /**
   * 更新时间(长期, 阶段, 特殊)
   */
  updateHour: "",
  /**
   * 升级次数(长期, 阶段, 特殊)
   */
  escalateStopover: "",
  remarks: "",
  memo: "",
});

watch(
  () => props.data,
  async (newVal: any) => {
    formData.id = "";
    if (newVal?.id) {
      const {
        id,
        countRuleCode,
        programId,
        abilityType,
        ruleLowestNum,
        ruleLowestDuration,
        continuousNum,
        intervalSecond,
        intervalHour,
        firstExecutionTime,
        cpkComputeHour,
        maxRange,
        rollInterval,
        maxUnit,
        version,
        enabled,
        deleted,
        createTime,
        createdUserId,
        createdUserName,
        lastUpdatedUserId,
        lastUpdatedUserName,
        lastUpdateTime,
        gageEquipToolKind,
        sampleNum,
        toolUseType,
        /**
         * 是否预警(单值,均值,长期,阶段, 特殊)
         */
        isWarn,
        /**
         * 连续超过控制限次数(单值,均值,长期)
         */
        controlRate,
        /**
         * 上限比例(单值)
         */
        upLine,
        /**
         * 下限比例(单值)
         */
        downLine,
        /**
         * 分组测量值个数(均值)
         */
        groupingNum,
        /**
         * 默认高于值(阶段, 特殊)
         */
        defaultTall,
        /**
         * 连续高于次数(阶段, 特殊)
         */
        tallStopover,
        /**
         * 连续高于值(阶段, 特殊)
         */
        successiveTall,
        /**
         * 连续低于次数(阶段, 特殊)
         */
        lowStopover,
        /**
         * 默认低于值(阶段, 特殊)
         */
        defaultLow,
        /**
         * 首次调查时间(长期, 阶段, 特殊)
         */
        checkHour,
        /**
         * 更新时间(长期, 阶段, 特殊)
         */
        updateHour,
        /**
         * 升级次数(长期, 阶段, 特殊)
         */

        remarks,
        memo,
        escalateStopover,
      } = newVal;
      Object.assign(formData, {
        id,
        countRuleCode,
        programId,
        abilityType,
        ruleLowestNum,
        ruleLowestDuration,
        continuousNum,
        intervalSecond,
        intervalHour,
        firstExecutionTime,
        cpkComputeHour,
        maxRange,
        rollInterval,
        maxUnit: maxUnit ?? undefined,
        version,
        enabled,
        deleted,
        createTime,
        createdUserId,
        createdUserName,
        lastUpdatedUserId,
        lastUpdatedUserName,
        lastUpdateTime,
        gageEquipToolKind,
        sampleNum,
        toolUseType,
        /**
         * 是否预警(单值,均值,长期,阶段, 特殊)
         */
        isWarn,
        /**
         * 连续超过控制限次数(单值,均值,长期)
         */
        controlRate,
        /**
         * 上限比例(单值)
         */
        upLine,
        /**
         * 下限比例(单值)
         */
        downLine,
        /**
         * 分组测量值个数(均值)
         */
        groupingNum,
        /**
         * 默认高于值(阶段, 特殊)
         */
        defaultTall,
        /**
         * 连续高于次数(阶段, 特殊)
         */
        tallStopover,
        /**
         * 连续高于值(阶段, 特殊)
         */
        successiveTall,
        /**
         * 连续低于次数(阶段, 特殊)
         */
        lowStopover,
        /**
         * 默认低于值(阶段, 特殊)
         */
        defaultLow,
        /**
         * 首次调查时间(长期, 阶段, 特殊)
         */
        checkHour,
        /**
         * 更新时间(长期, 阶段, 特殊)
         */
        updateHour,
        /**
         * 升级次数(长期, 阶段, 特殊)
         */
        remarks,
        memo,
        escalateStopover,
      });
      console.log(id);
      if (formData.id) {
        hh.value = false;
        getoldList();
      }
      formData.abilityType = JSON.stringify(formData.abilityType);
      formData.maxUnit = JSON.stringify(formData.maxUnit);

      console.log(formData);
    }

    if (newVal?.abilityType) {
      formData.abilityType = newVal.abilityType.toString();
    }
    if (
      formData.abilityType == "0" ||
      formData.abilityType == "2" ||
      formData.abilityType == "4"
    ) {
      formData.toolUseType = "2";
    } else {
      formData.toolUseType = "1";
    }
    if (newVal?.programId) {
      formData.programId = newVal.programId;
    }
  }
);

/** 关闭表单弹窗 */
function closeDialog() {
  visibleDialog.value = false;
  emit("change-visible", false);
  resetForm();
}

/** 重置表单 */
function resetForm() {
  formRef.value.resetFields();
  formRef.value.clearValidate();
  formData.id = "";
  formData.countRuleCode = "";
  formData.programId = "";
  formData.abilityType = "";
  formData.ruleLowestNum = "";
  formData.ruleLowestDuration = "";
  formData.continuousNum = "";
  formData.intervalSecond = "";
  formData.intervalHour = "";
  // formData.firstExecutionTime = "";
  formData.cpkComputeHour = "";
  formData.maxRange = "";
  formData.rollInterval = "";
  formData.maxUnit = "";
  formData.version = "";
  formData.enabled = "";
  formData.deleted = "";
  formData.createTime = "";
  formData.createdUserId = "";
  formData.createdUserName = "";
  formData.lastUpdatedUserId = "";
  formData.lastUpdatedUserName = "";
  formData.lastUpdateTime = "";
  formData.gageEquipToolKind = "";
  formData.toolUseType = "";

  //后加
  /**
   * 默认样本个数(单值,均值)
   */
  formData.sampleNum = "";
  /**
   * 是否预警(单值,均值,长期,阶段, 特殊)
   */
  formData.isWarn = "";
  /**
   * 连续超过控制限次数(单值,均值,长期)
   */
  formData.controlRate = "";
  /**
   * 上限比例(单值)
   */
  formData.upLine = "";
  /**
   * 下限比例(单值)
   */
  formData.downLine = "";
  /**
   * 分组测量值个数(均值)
   */
  formData.groupingNum = "";
  /**
   * 默认高于值(阶段, 特殊)
   */
  formData.defaultTall = "";
  /**
   * 连续高于次数(阶段, 特殊)
   */
  formData.tallStopover = "";
  /**
   * 连续高于值(阶段, 特殊)
   */
  formData.successiveTall = "";
  /**
   * 连续低于次数(阶段, 特殊)
   */
  formData.lowStopover = "";
  /**
   * 默认低于值(阶段, 特殊)
   */
  formData.defaultLow = "";
  /**
   * 首次调查时间(长期, 阶段, 特殊)
   */
  formData.checkHour = "";
  /**
   * 更新时间(长期, 阶段, 特殊)
   */
  formData.updateHour = "";
  /**
   * 升级次数(长期, 阶段, 特殊)
   */
  formData.escalateStopover = "";
  formData.remarks = "";
  formData.memo = "";
  oldList = [];
  hh.value = false;
}

//改变之后 重置

const restForm = () => {
  formData.countRuleCode = "";
  formData.programId = "";

  formData.ruleLowestNum = "";
  formData.ruleLowestDuration = "";
  formData.continuousNum = "";
  formData.intervalSecond = "";
  formData.intervalHour = "";
  // formData.firstExecutionTime = "";
  formData.cpkComputeHour = "";
  formData.maxRange = "";
  formData.rollInterval = "";
  formData.maxUnit = "";

  //后加
  /**
   * 默认样本个数(单值,均值)
   */
  formData.sampleNum = "";
  /**
   * 是否预警(单值,均值,长期,阶段, 特殊)
   */
  formData.isWarn = "";
  /**
   * 连续超过控制限次数(单值,均值,长期)
   */
  formData.controlRate = "";
  /**
   * 上限比例(单值)
   */
  formData.upLine = "";
  /**
   * 下限比例(单值)
   */
  formData.downLine = "";
  /**
   * 分组测量值个数(均值)
   */
  formData.groupingNum = "";
  /**
   * 默认高于值(阶段, 特殊)
   */
  formData.defaultTall = "";
  /**
   * 连续高于次数(阶段, 特殊)
   */
  formData.tallStopover = "";
  /**
   * 连续高于值(阶段, 特殊)
   */
  formData.successiveTall = "";
  /**
   * 连续低于次数(阶段, 特殊)
   */
  formData.lowStopover = "";
  /**
   * 默认低于值(阶段, 特殊)
   */
  formData.defaultLow = "";
  /**
   * 首次调查时间(长期, 阶段, 特殊)
   */
  formData.checkHour = "";
  /**
   * 更新时间(长期, 阶段, 特殊)
   */
  formData.updateHour = "";
  /**
   * 升级次数(长期, 阶段, 特殊)
   */
  formData.escalateStopover = "";
  formData.remarks = "";
  formData.memo = "";
  oldList = [];
  hh.value = false;
};

const loading = ref(false);

/** 测量数据取样配置保存提交 */
function handleSubmit() {
  formRef.value.validate(async (valid: any) => {
    if (valid) {
      loading.value = true;
      const text = formData.id ? "编辑" : "新增";
      // if (formData.abilityType === "3") {
      //   formData.ruleLowestDuration = "";
      //   formData.intervalSecond = "";
      //   formData.intervalHour = "";
      //   formData.cpkComputeHour = "";
      //   formData.maxRange = "";
      //   formData.rollInterval = "";
      //   formData.maxUnit = "";
      // }
      await request({
        url: "/dmpDosPcm/pcmconfigmeasurements/save",
        method: "post",
        data: formData,
      }).finally(() => {
        loading.value = false;
      });
      ElMessage.success(text + `成功`);
      closeDialog();
      emit("reset-table", formData.id);
    }
  });
}

// 组件销毁时调用
onBeforeUnmount(() => {
  visibleDialog.value = false;
  emit("change-visible", false);
});

watch(
  () => formData.abilityType,
  (newVal) => {
    isNotStage.value = newVal !== "3";
  },
  { deep: true }
);

const deleteItem = (id) => {
  ElMessageBox.confirm("确认删除已选中的数据项?", "警告", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  }).then(async () => {
    const { data } = await request({
      url: `/dmpDosPcm/pcmconfigmeasurements/deleteItem/${id}`,
      method: "post",
    }).then(() => {
      ElMessage.success("删除成功");
      closeDialog();
    });
  });
};

const abilityTypeChange = (e) => {
  if (e) {
    restForm();
    monitoringDescription.forEach((item) => {
      if (formData.abilityType == item.value) {
        formData.memo = item.label;
      }
    });
    console.log(111);

    if (!formData.id) {
      console.log(222);

      formData.firstExecutionTime = dayjs(new Date()).format("YYYY-MM-DD HH");
      console.log(formData.firstExecutionTime);
    }
    if (
      formData.abilityType == "0" ||
      formData.abilityType == "2" ||
      formData.abilityType == "4"
    ) {
      formData.toolUseType = "2";
    } else {
      formData.toolUseType = "1";
    }
  } else {
    formData.toolUseType = "";
    formData.memo = "";
  }
};

// 获取 上一次的数据
let oldList = reactive([]);
const hh = ref(false);
const getoldList = async () => {
  await request({
    url: `/dmpDosPcm/pcmconfigmeasurements/getLastRecord`,
    method: "get",
    params: {
      id: formData.id,
    },
  })
    .then((res) => {
      oldList = [];
      oldList.push({ ...res.data });
      hh.value = true;
      console.log("oldList", oldList[0]);
      console.log("oldList", oldList.length);
    })
    .catch(() => {
      oldList = [];
      hh.value = false;
      console.log("oldList", oldList);
      console.log("oldList", oldList.length);
    });
};
</script>
<style scoped>
.yellow-icon :deep(.el-icon) {
  /* color: #ffb441; */
  color: gray;
  font-size: 15px; /* 根据需要调整大小 */
  height: 65%;
  margin-left: 5px;
}

/* ::v-deep .is-bordered-label {
    width: 25% !important;
  }
  
  ::v-deep .is-bordered-content {
    width: 25% !important;
  } */

.el-picker-panel {
  .el-scrollbar:nth-of-type(2) {
    display: none !important;
  }
}

.el-time-spinner {
  text-align: center;
}
:deep(.el-descriptions__label.el-descriptions__cell.is-bordered-label) {
  width: 170px;
}
:deep(.el-descriptions__content.el-descriptions__cell.is-bordered-content) {
  min-width: 100px;
}
</style>
